/**
 * @author harry
 * @date 2022/4/5/21:25
 */

package com.serviceOrchestration.pojo;

import lombok.Data;

@Data
public class ProductClient {
    private String id;
    private String name;
    private int period;
    private int annualRate;
    private int minAmount;
    private int maxAmount;
    private int incAmount;
    private int dailyAmount;
    private int surplus;
    private boolean showInterest;
    private boolean clientCheck;

    public ProductClient(Product p) {
        id = p.getId();
        name = p.getName();
        period = p.getPeriod();
        annualRate = p.getAnnualRate();
        minAmount = p.getMinAmount();
        maxAmount = p.getMaxAmount();
        incAmount = p.getIncAmount();
        dailyAmount = p.getDailyAmount();
        surplus = p.getSurplus();
        showInterest = isShowInterest(p);
        clientCheck = isClientCheck(p);
    }

    private boolean isShowInterest(Product p) {
        return p.getServiceJson().contains("\"id\":7");
    }

    private boolean isClientCheck(Product p) {
        return p.getServiceJson().contains("\"id\":2");
    }
}
